package com.david.interview.step1;

/**
 * 懒汉式--加锁 只有为null的时候才进行加锁
 * @author David
 * @version V1.0
 * @Package com.david.interview.step1
 * @date 2021/6/29 23:37
 */
public class P02Singleton6 {
    public volatile static P02Singleton6 INSTANCE;
    private P02Singleton6(){}
    public static P02Singleton6 getInstance(){
        if (INSTANCE==null){
            synchronized (P02Singleton6.class){
                if (INSTANCE==null){
                    INSTANCE=new P02Singleton6();
                }
            }
        }

        return INSTANCE;
    }
}
